/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
var req;
var response;

function pesquisaLojas(query){
    try{
        // var query = document.getElementsByName("pesquisa")[0].value;
        
        req = initRequest();
        req.open('GET', 'pesquisaLojas?query='+query, true);
        req.onreadystatechange = callBack;
        req.send(null);
       
    }catch(err){
        alert(err);
    }
}
function callBack(){
    if(req.readyState==4){
        response= req.responseText;
        document.getElementById("listaLojas").innerHTML=response;
    }
}
function initRequest() {
    if (window.XMLHttpRequest) {
        if (navigator.userAgent.indexOf('MSIE') != -1) {
            isIE = true;
        }
        return new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        isIE = true;
        return new ActiveXObject("Microsoft.XMLHTTP");
    }
}